import request from '@/utils/request'
// 用户管理获取所有用户账号密码
export const getUserAPI = () => {
  return request({
    method: 'GET',
    url: '/user'
  })
}
// 根据id删除用户
export const delUserAPI = (id) => {
  return request({
    method: 'DELETE',
    url: `/user/${id}`
  })
}
// 新增用户
export const addUserAPI = ({ username, password, nickname }) => {
  return request({
    method: 'POST',
    url: '/user',
    data: {
      username,
      password,
      nickname
    }
  })
}
// 根据id更新用户信息
export const updateUserAPI = (data, id) => {
  return request({
    method: 'PUT',
    url: `/user/${id}`,
    data: {
      username: data.cate_username,
      password: data.cate_password,
      nickname: data.cate_nickname
    }
  })
}
// 获取用户信息
